#ifndef LOGGERMANAGER_H
#define LOGGERMANAGER_H

#include <spdlog/spdlog.h>
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <memory>
#include <QString>

class LoggerManager
{
public:
    static LoggerManager& getInstance();

    void init();
    std::shared_ptr<spdlog::logger> getLogger();

    void logInfo(const QString& content);
    void logWarning(const QString& content);
    void logError(const QString& content);
    void logOperation(const QString& content);

private:
    LoggerManager() = default;
    LoggerManager(const LoggerManager&) = delete;
    LoggerManager& operator=(const LoggerManager&) = delete;

    void logToDatabase(const QString& type, const QString& content);

    std::shared_ptr<spdlog::logger> logger;
    QSqlDatabase db;
};

#endif // LOGGERMANAGER_H
